<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>查看数据</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../assets/libs/layui/css/layui.css" media="all">
</head>

<body>

    <form class="layui-form" lay-filter="example">

        <div class="layui-form-item" style="margin-top: 20px">
            <label class="layui-form-label">手办编号:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="id" disabled="true" autocomplete="off" placeholder="" id="id"
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" style="margin-top: 20px">
            <label class="layui-form-label">手办名称:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="" disabled="true"
                    id="name" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手办现价:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="porice" lay-verify="required" placeholder="" disabled=" true" id="porice"
                    autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">手办库存:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="stock" lay-verify="required" placeholder="" disabled=" true" id="stock"
                    autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">手办图片:</label>
            <div class="layui-input-block" style="margin-right: 20px" id="urlList">

            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">手办类型:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="info" lay-verify="required" placeholder="" disabled=" true" id="info"
                    autocomplete="off" class="layui-input">
            </div>
        </div>


    </form>

    <style>
        #urlList img {
            margin: 5px;
        }
    </style>
    <script src="../../assets/libs/layui/layui.js" charset="utf-8"></script>
    <script src="../js/util.js" charset="utf-8"></script>
    <script>



        layui.config({
            base: '/module/'
        }).use(['jquery', 'layer', 'table', 'form', 'config'], function () {
            var $ = layui.jquery;
            var layer = layui.layer;
            var table = layui.table;
            var form = layui.form;
            var config = layui.config;
            var req = GetRequest();

            var no = req['editNo'];//获取请求的url参数editNo的值
            //获取当前编辑的数据
            $.ajax({
                url: config.base_server + 'GetGoodsById?editNo=' + no,
                dataType: 'json',
                type: 'get',
                success: function (data) {
                    data = data.data;
                    console.log(data)
                    $('#id').val(data[0].id);
                    $('#name').val(data[0].name);
                    $('#porice').val(data[0].porice);
                    $('#stock').val(data[0].stock);
                    (data[0].urlList).forEach(item => {
                        $('#urlList').append('<img  src="' + item + '" alt="" srcset="" disabled="true" name="goodsImg" id="goodsImg" width="100" height="100" />');
                    })
                    $('#info').val(data[0].info);
                }


            })



        });
    </script>


</body>